Skip to content

V2 spec follow-ups: SSL.com DCV, reissue endpoint, revoke fallback, token retry (0094, 0095) - #40

Merged
spbsoluble merged 31 commits into
feat/v2-consolidatedfrom
feat/v2-spec-followups
Nov 17, 2026
Merged

spbsoluble merged 31 commits into
feat/v2-consolidatedfrom
feat/v2-spec-followups

Conversation

@spbsoluble

@spbsoluble spbsoluble commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-ups to match CERTInext's V2 spec: DCV for SSL.com-validated domains, the reissue endpoint, a revoke-reason fallback, token retry, and quieter sync for orders that Track Order can't find.

Features

  • DCV for SSL.com-validated domains:
    • Before DCV, the plugin looks up each pending domain.
    • For an SSL.com domain, it publishes SSL.com's own TXT record, calls verify, then cleans up.
    • It only uses dns-txt, because the gateway's DNS interface can't stage a CNAME.
    • A failure leaves the order pending; the order is never cancelled.
    • If the lookup fails, the existing emSign flow runs unchanged.
    • Record values are never logged.
  • Reissue through POST /ssl-certificates/{orderId}/reissue:
    • Used for Reissue, and for RenewOrReissue outside RenewalWindowDays, in rekey mode.
    • The new order id (for example 3527789913R001) becomes the CARequestID.
    • New setting V2ReissueRevokePrevious (default false) also revokes the old certificate as superseded, and logs that first.
    • With no prior order, or a 404/422 answer, the plugin places a new order instead and says so.
    • A 5xx or lost response fails with "do not resubmit".
  • Sync summary: lists every orderStatus | certificateStatus pair the plugin can't map, with counts.

Fixes

  • Revoke reason privilege-withdrawn: CERTInext now rejects it with new wording. Either wording now retries once as cessation-of-operation.
  • V2 token requests:
    • A request that gets no HTTP response is retried twice (after 1 s, then 3 s).
    • Real HTTP answers are final, and order creates are still never retried.
    • The log now shows the transport detail, with secrets removed.
  • Rows that Track Order can't find (On Hold | Setup Pending):
    • Sync skips them with one Information line and counts them as UntrackableListedOrders.
    • They no longer count as errors toward the 25% abort.
  • prevettingToken: the JSON name now matches the spec. Nothing sends it yet.

Chores

  • The revoke-reason docs now match spec 2.0.0.
  • Added live probes and documented their flags.

Testing

  • Release build: 0 warnings, with DcvSupport true and false.
  • Unit tests: 1296/1296 (60 new).
  • WireMock tests:
    • The domain DCV endpoints.
    • Reissue end to end: the request body, revokePrevious on and off, UCC domains, the fallbacks, no fallback on a 5xx, and the new order id carried through enroll, GetSingleRecord and sync.
  • Token retry: tested through a local proxy that drops the connection.

Other

spbsoluble and others added 15 commits November 13, 2026 16:53
…endpoints (0094 item 1)

Each pending V2 domain is looked up with GET /domains?search=&exactMatch=true. For
validatedBy=SSLCOM the plugin reads SSL.com's record from GET /domains/{id}/dcv, publishes
its dns-txt recordName/recordValue (not DcvTxtRecordTemplate), verifies with
POST /domains/{id}/dcv/verify {optionId}, and cleans up. dns-cname/http-url can't be staged
through IAnyCAPlugin 3.3's TXT-only IDomainValidator, so those domains stay pending with a
warning. 502s, unknown shapes and 422 PENDING/UNDER_REVIEW leave the order pending for sync;
nothing is cancelled. A failed lookup or emSign row keeps the order-level flow. UCC orders
route each domain by its own row.

Live (sandbox): the /domains row id is domainId; the account has no SSLCOM domains, so the
SSL.com path is unit-tested only.
…tion; match CERTInext's newer reason-rejection wording (0094 item 2)

The 2.0.0 spec dropped privilege-withdrawn from the SSL/TLS revoke enum, and live (2026-11-13)
now rejects it with 422 "Revocation reason privilege-withdrawn is not allowed." - a different
wording from the "Invalid Revoke Reason ID" the fallback matched, so a reason-9 revoke failed
with no retry. The first attempt still sends privilege-withdrawn; a rejection in either wording
now retries once with cessation-of-operation. Opt-in live tests: privilege-withdrawn acceptance
on an own order, and a per-reason acceptance probe.
…094 item 3)

The spec's SSL/TLS enum now has 9 values including aa-compromise and no privilege-withdrawn;
the bullet said 8 and that aa-compromise was Private PKI/Document Signer only.
…revettingToken (0094 item 4)

SslOrganizationRef names it prevettingToken; the DTO sent preVettingToken. Nothing sets the
token today, so this is wire-neutral; a serialization test pins the spelling.
…e; V2ReissueRevokePrevious (0094 item 5)

A V2 SSL/TLS Reissue, or a RenewOrReissue whose prior certificate is unexpired and outside
RenewalWindowDays (V1's reissue boundary), resolves the prior order from PriorCertSN and calls
/reissue in rekey mode with the new CSR and UCC additionalDomains. The derived order id
(e.g. 1984857369R001) becomes the CARequestID and the normal post-create flow (track,
agreement, DCV, pickup) runs on it. update-sans is never used: Command gives no signal that
only SANs changed.

New connector setting V2ReissueRevokePrevious (Boolean, default false; constants, config,
annotation, ValidateCAConnectionInfo, manifest): sends revokePrevious=true with
revokeReason=superseded, audit-logged before the call.

No prior order, or a 404/422, falls back to a new order and the result message says so. A
5xx, lost response or 2xx without an order id throws with the do-not-resubmit wording and
places nothing. Private PKI/Document Signer keep their behaviour. Order ids were already
handled as opaque strings everywhere (audited); a WireMock test round-trips a derived id
through enroll, GetSingleRecord and Sync. Opt-in live test (not yet run):
CERTINEXT_V2_LIFECYCLE_REISSUE_ENDPOINT=1 + CERTINEXT_V2_REISSUE_SOURCE_ORDER_ID.
… transport detail (0095)

A token request that gets no HTTP response is retried twice (1 s, 3 s); it is idempotent and
creates nothing. HTTP answers (400/401/403 included) are final, and order creates are still
never retried. The failure log and exception now carry TransportDetail (RestSharp
ResponseStatus plus the exception chain's types/messages, passed through RedactCredentials
with the configured secret values replaced and capped) instead of only HttpStatus=0.
LogV2ApiFailure/ThrowOnV2Failure, the inline-CSR create and the reissue do the same for any V2
call with no response; ThrowOnV2Failure keeps 'HTTP 0.' first so IsTransportLevelCsrFailure
still reads status 0.

Tests drive a real dropped connection through a loopback TCP proxy (WireMock's faults still
send a 200 status line): enroll, sync and connector validation each succeed with two token
attempts; a permanent drop tries three times with no secret in the message; 400/401/403 are
tried once.
… acceptance; tidy reissue result message

Sync_UnresolvedReportStatuses_Probe (read-only) lists every /reports/orders status pair, the
rows the mapping can't place (UnresolvedStatusFallbacks) and a Track Order sample of rows whose
two fields disagree. Live: the only unmapped pair is 'On Hold | Setup Pending' (6 orders, Track
404 in every family), so no mapping change; 'Order Accepted | Rejected due to Order
Cancellation' tracks as pending-dcv, so it is not remapped either (Finding 33 update).
The reissue live test now routes logs before building the plugin, and the reissue note is
joined to the result message with a sentence break.
…ad of counting them as errors

Every 'On Hold | Setup Pending' row on the sandbox falls back to Track Order, which finds the
order in no family. Each one logged an error with a stack trace and counted toward the
25% error-rate abort. Such rows are now skipped for the pass with one Information line and
counted as UntrackableListedOrders in the summary; a later pass tracks them again. Nothing is
emitted for them (no evidence the order failed). The reissue success log now carries the
HTTP status. Adds a read-only live full-sync summary probe.
…summary

CERTInext documents none of the report's orderStatus/certificateStatus display strings
(Finding 35), so the only way to learn new ones is to observe them. The summary line now
carries UnmappedReportStatuses=[pair (count); ...] at Information instead of leaving each
to a per-row Debug line.
…ws through Track Order

The report row says fulfilled while the certificate status says pending; Track Order
returns issued (live: 1125823297). Preferring certificateStatus reported the order as
pending and never downloaded the certificate. That one shape (order maps issued,
certificate maps pending) now maps to null so the sync asks Track Order, and the pair
appears in UnmappedReportStatuses. Other disagreements keep their mapping.
FindSslComDomainAsync called GET /domains for every pending domain on every DCV
attempt, so a pass over many orders under one domain repeated the same lookup. A
per-pass cache (one per sync pass, one per Enroll/GetSingleRecord DCV call) keeps
found rows and "no row"; failed lookups aren't cached and fall back to emSign as
before. Only DomainId/validatedBy come from the cached row; DCV state is still read
fresh per order. Sync processes rows sequentially, so a plain dictionary.
…entry

Command fails the Keyfactor-Enroll workflow step at its global Workflow Step Run
Timeout (Workflow.General.Timeout, 60 s by default; the step has no timeout of its
own). The pickup budget (5 s + PickupRetries x PickupDelay, capped at 75 s) was
counted from the start of the pickup, so the create time came on top: on the lab a
new DV order and a reissue (26 s) both reached Command's 60 s, which recorded a
failure while the order went on at CERTInext.

New setting EnrollmentCallBudgetSeconds (default 50, 0 disables, clamped to 90 under
the 100 s HttpClient timeout). Enroll starts an EnrollmentDeadline, carried in an
AsyncLocal to the V1 new/renew and V2 pickups. They shorten waits to keep a 3 s poll
margin, skip the delay after the last poll, and stop with one Information line when
no poll fits. In-flight calls are never cut short; PickupRetries=0 is unchanged;
inline DCV is not bounded (documented as a known limitation).
… parameters

OrgRepresentativeName/Email (together) plus optional Phone/Designation/EmployeeId send
organization.useNewOrgRepresentative=true with an organizationRepresentative block on
a V2 OV create. ValidateProductInfo and EnrollV2CoreAsync share one check that mirrors
CERTInext's rules before any CA call: OV only (EMS-1315), a pre-vetted organization
(EMS-1316), name and email together (EMS-1319/1320), one email, phone 6-15 digits
(EMS-1321). Error messages name parameters, never values. V1 ignores them (warns at
save); a reissue doesn't send them. The create response's
organizationRepresentativeStatus is logged; pendingOrganizationRepresentative is kept
raw (undocumented shape) and only its presence logged.

Personal data: employeeId and the block keys join PersonalOtherFieldNames, and emails
inside CA error text (detail/title/message/errorMessage) in logged bodies are now
masked; an EMS-1317 error echoing the representative's email used to reach the
Warning-level V2 non-success line unmasked.
github-actions Bot and others added 10 commits November 15, 2026 20:20
…prover' order

Opt-in (CERTINEXT_V2_FULFILLED_PENDING_SYNC=1), read-only. A DispatchProxy narrows the
real report listing to one order and forwards every other call to the real client, so
the actual Synchronize path runs live. Asserts the row defers to Track Order, comes out
issued, and has its certificate download attempted. Live 2026-11-15 on 1125823297:
Track issued, download 422 EMS-1165 (never generated), emitted issued without a body.
… its certificate isn't generated

Live on 1125823297: Track Order says issued, but Download Certificate answers 422
EMS-1165 for an order placed months before the sandbox stopped generating, so the
report's 'Pending for Approver' was right. Such a row (Track fallback said issued, the
report's certificate status maps to pending, download EMS-1165) is now emitted pending
instead of issued without a certificate. The download is still tried every pass, so
a certificate that appears is imported. Other download failures, and rows whose
report doesn't say pending, keep the issued-without-body behaviour.
…certificate and a pending certificate state

Matches the V2 sync rule: Track says issued, Download Certificate answers 422
EMS-1165, and the order's certificateState (same text as the report's
certificateStatus: Pending for Approver, Approved by System, Order Accepted) maps to
pending, so the record is pending rather than issued without a body. An
unrecognized or non-pending state, and other download failures, keep the existing
result. Docs no longer claim the plugin never acts on certificateState.
… certificate and a pending state

Opt-in with CERTINEXT_V2_FULFILLED_PENDING_SYNC=1, read-only, DCV off; orders from
CERTINEXT_V2_SINGLE_RECORD_ORDERS. Also relaxes nothing in the sync test, which now
expects pending without a body. Live 2026-11-16: 1125823297 (Pending for Approver)
and 6292373831 (Approved by System) both returned pending (90); the one-order sync
emitted 1125823297 pending.
…sign synced certificates a template

The gateway gives a synced record a certificate profile only when its ProductID
equals a configured template's ProductID (a GetProductIds() name) exactly
(Gateway-AnyCA-REST CertificateService.CreateOrUpdateDBCertificate, called only from
CASyncJob). Both syncs sent CERTInext product codes, which never matched: all 927
sync-created lab rows had no profile, and those certificates reached Command with no
template.

Each V1/V2 sync pass now reads the account catalog once (on first use) and names a
code by productTypeID via the inverse of ProductTypeIdsV2. No fixed code table: the
V1-era DefaultProductCodes would label the sandbox's DV 842 'OV SSL'. Unknown codes,
types with no plugin product, and an unreadable catalog (one warning) keep the code.
The sync summaries gain ProductNames Resolved/Unresolved. GetSingleRecord is
unchanged: the gateway doesn't use its ProductID for the mapping.

Includes a read-only catalog probe (V1 and V2 catalogs are identical on the sandbox).
…ad-only)

Explains why a gateway row isn't re-saved by the sync. Opt-in with
CERTINEXT_SYNC_PRODUCTID_PROBE=1 and CERTINEXT_PROBE_ORDERS. Live 2026-11-16: the 8
gateway rows still pending without a profile are all 'Order Cancelled | Rejected due
to Order Cancellation' (Track: cancelled), which the sync skips.
… still holds it as pending

Both syncs skip orders cancelled or rejected at CERTInext, and the gateway changes a
row only when the sync emits a record for it, so an order it held as pending stayed
pending indefinitely (8 kfclab rows, all 'Order Cancelled | Rejected due to Order
Cancellation', Track: cancelled). Before skipping, the sync now asks the gateway
(ICertificateDataReader.GetStatusByRequestID): held as pending -> emit failed with no
certificate, once. No row (ArgumentException), already terminal, issued/revoked
(never downgraded), no reader, or a lookup error keep the skip. Summaries gain
FailedPropagated. Issue 0098.
@spbsoluble
spbsoluble added this pull request to stack #45 November 17, 2026 03:19
spbsoluble and others added 3 commits November 16, 2026 20:02
…ildcard CN

A DV/OV request with CN = apex and SAN = *.apex failed with EMS-1173: the
wrapper keys "wildcard" on certificate.domain alone and resolved a plain
UCC product. Sending the wildcard as the domain is rejected too (EMS-1056,
the domain must match the CSR CN). Both confirmed live.

With no template ProductCode, the plugin now reads the catalog and sends
the account's single active Wildcard UCC product (typeID 21 DV / 22 OV) as
X-Product-Code. No match, several matches, a catalog failure, or EV fails
before any order is placed, asking for ProductCode.

Adds unit coverage and an opt-in live probe (CERTINEXT_V2_WILDCARD_SAN_PROBE).
@spbsoluble
spbsoluble merged commit 087554f into release-2.0 Nov 17, 2026
16 of 17 checks passed
@spbsoluble
spbsoluble deleted the feat/v2-spec-followups branch November 17, 2026 04:18
@indrora
indrora restored the feat/v2-spec-followups branch November 17, 2026 04:18
@spbsoluble
spbsoluble deleted the feat/v2-spec-followups branch November 17, 2026 04:18
@indrora
indrora restored the feat/v2-spec-followups branch November 17, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant